home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beginning Mac Programming
/
Beginning Mac Programming.bin
/
Open Me for REALbasic 3
/
REALbasic 3.2
/
Example Projects
/
Techniques
/
Examples by Joe Strout
/
Basic Console
/
Sample Programs.txt
< prev
Wrap
Text File
|
2000-04-17
|
1KB
|
64 lines
Sample Console-Basic Programs
This file contains some sample programs for use with the Console app. Copy
the contents of "ProgramCode" into the Main() method of the ProgramCode class
in RB. Copy the contents of "ProgramData" (if any) into the Text property of
the big text box in the ProgramData class in RB. Then Run and enjoy!
======================================================================
ProgramCode:
// This program asks your name, then prints it a number of times.
Dim i as Integer
Dim qtystr as String
Dim name as String
Dim s as String
Dim done as Boolean
do until done
Clear
Input "Enter your name: ", name
Input "Enter quantity: ", qtystr
for i = 1 to Val(qtystr)
Print name + " was here!"
next
Input "Do it again (Y/N)? ", s
done = (left(s,1) = "N")
loop
----------------------------------------------------------------------
ProgramData:
(none)
----------------------------------------------------------------------
======================================================================
ProgramCode:
// Demonstrates use of the Read statement to grab
// data from ProgramData.
Dim i as integer
Dim s as String
Dim d as Double
for i = 1 to 3
ReadStr s
Print "String... >" + s + "<"
next
for i = 1 to 3
ReadNum d
PrintNoCR "Number... "
Print d
next
----------------------------------------------------------------------
ProgramData:
"foo","bar"
"baz", 1
2.5,3.8
======================================================================